package com.hexacta.hrs.domain.feedback;

import java.text.NumberFormat;

public class FeedbackPeriodResumeByRole {

	private String function;
	private String code;
	private Long numberOfEmployees;
	private Long numberOfFeedbacks;
	private Long numberOfCompletedFeedbacks;
	private boolean closed;
	
	public FeedbackPeriodResumeByRole(String function, String code, Long numberOfEmployees,
			Long numberOfFeedbacks, Long numberOfCompletedFeedbacks, boolean closed) {

		this.function = function;
		this.code = code;
		this.numberOfEmployees = numberOfEmployees;
		this.numberOfFeedbacks = numberOfFeedbacks;
		this.numberOfCompletedFeedbacks = numberOfCompletedFeedbacks;
		this.closed = closed;
	}

	public String getFunction() {
		return function;
	}

	public void setFunction(String function) {
		this.function = function;
	}
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	public void setClosed(boolean closed) {
		this.closed = closed;
	}
	
	public boolean isClosed() {
		return closed;
	}

	public Long getNumberOfEmployees() {
		return numberOfEmployees;
	}

	public void setNumberOfEmployees(Long numberOfEmployees) {
		this.numberOfEmployees = numberOfEmployees;
	}

	public Long getNumberOfFeedbacks() {
		return numberOfFeedbacks;
	}

	public void setNumberOfFeedbacks(Long numberOfFeedbacks) {
		this.numberOfFeedbacks = numberOfFeedbacks;
	}

	public Long getNumberOfCompletedFeedbacks() {
		return numberOfCompletedFeedbacks;
	}

	public void setNumberOfCompletedFeedbacks(Long numberOfCompletedFeedbacks) {
		this.numberOfCompletedFeedbacks = numberOfCompletedFeedbacks;
	}

	public Long getNumberOfIncompleteFeedbacks() {
		return this.getNumberOfFeedbacks() - this.getNumberOfCompletedFeedbacks();
	}
	
	public boolean checkClosed(){
		if(this.getNumberOfCompletedFeedbacks().longValue() != this.getNumberOfFeedbacks().longValue()){
			return true;
		}else{
			return false;
		}
	}
	
	public String getPercentageOfCompletion() {
		NumberFormat f = NumberFormat.getInstance();
        f.setMinimumFractionDigits(2);
        f.setMaximumFractionDigits(2);
        return f.format(new Double(this.getNumberOfCompletedFeedbacks()) * 100 / new Double(this.getNumberOfFeedbacks()));  
	}
}
